"use strict";



//登录与认证TOKEN
//user
//pass

module.exports = async function () {
    let user = this.get("user");
    if(!user){
        return this.error("user empty");
    }
    let pass = this.get("pass");
    if(!pass){
        return this.error("pass empty");
    }

    

    let developsModel = this.model.branch('develops');
    let ret=await developsModel.login(user);
    if(!ret){
        return this.error('账号不存在');
    }
    if(ret['status'] < 1){
        return this.error("账号已被禁用");
    }
    //BOBTODO 开发者密码做加密
    if(ret['xcode']!=pass){
        return this.error('password error');
    }
    // let verify_xcode = developsModel.password(pass);
    // console.log(pass,verify_xcode,ret['xcode']);
    // if( verify_xcode !== ret['xcode']){
    //     return this.error('password error');
    // }
    return user;
}